<template>
  <div class="home">
    <div class="row">
      <div class="col-md-3 practice" v-for="(num,index) in nums" :key="index">{{num}}</div>
    </div>
  </div>
</template>

<script>
// @ is an alias to /src
import HelloWorld from "@/components/HelloWorld.vue";

export default {
  name: "home",
  data() {
    return {
      nums: []
    };
  },
  created() {
    this.problem();
    console.log(this.nums);
  },
  mounted() {},
  methods: {
    //试试注释
    
    problem() {
      for (var i = 0; i <80; i++) {
        var mth = Math.round(Math.random());
        var num1 = Math.round(Math.random() * 20 + 1);
        if (mth) {
          var num2 = Math.round(Math.random() * (20 - num1));
          var pro = num1 + "+" + num2 + "=";
          this.nums.push(pro);
        } else {
          var num2 = Math.round(Math.random() * num1);
          var pro = num1 + "-" + num2 + "=";
          this.nums.push(pro);
        }
      }
    }
  },
  components: {
    HelloWorld
  }
};
</script>
<style>
.practice {
  height: 60px;
  font-size: 22px;
}
</style>
